home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Interactive Wave / _DATAS / SHARED.Dxr / 00976_Macro Gestion du Clavier.ls < prev    next >
Encoding:
Text File  |  1995-08-06  |  3.2 KB  |  135 lines

  1. on ActiveTouchesPlus Parametres
  2.   global listTouchesPlus
  3.   set listTouchesPlus to Parametres
  4. end
  5.  
  6. on DesactiveTouchesPlus
  7.   global listTouchesPlus
  8.   set listTouchesPlus to list()
  9. end
  10.  
  11. on GestionTouchesPlus AccuKey
  12.   global listTouchesPlus
  13.   set AccuQ to getOne(listTouchesPlus, "ALPHABET")
  14.   if AccuQ <> 0 then
  15.     set NomMacro to getAt(listTouchesPlus, AccuQ + 1) & "(" & string(AccuKey) & ")"
  16.     CallM(NomMacro)
  17.   end if
  18.   set AccuP to getOne(listTouchesPlus, AccuKey)
  19.   if AccuP <> 0 then
  20.     CallM(getAt(listTouchesPlus, AccuP + 1))
  21.   end if
  22.   return AccuP
  23. end
  24.  
  25. on ActiveTouches
  26.   set the keyDownScript to "GestionPresseTouche"
  27. end
  28.  
  29. on DesactiveTouches
  30.   set the keyDownScript to EMPTY
  31.   DesactiveTouchesPlus()
  32.   DesactiveSkip()
  33. end
  34.  
  35. on GestionPresseTouche
  36.   set AccuKey to the keyCode
  37.   if GestionTouchesPlus(AccuKey) <> 0 then
  38.     exit
  39.   end if
  40.   if SonParClavier(AccuKey) <> 0 then
  41.     exit
  42.   end if
  43.   if AccuKey = 49 then
  44.     return CallM("ExecuteSkip")
  45.   end if
  46.   set listKeyTouches to list(126, "SautDePuce", 123, "Retour", 124, "Suite", 51, "Fusee")
  47.   set AccuP to getOne(listKeyTouches, AccuKey)
  48.   GestionPommeQ()
  49. end
  50.  
  51. on GestionPommeQ
  52.   if the commandDown = 0 then
  53.     exit
  54.   end if
  55.   if (the key = "W") or (the key = "w") then
  56.     quit()
  57.   end if
  58.   if (the key = ".") or (the key = "q") or (the key = "Q") then
  59.     Quitter()
  60.   end if
  61. end
  62.  
  63. on SonParClavier AccuKey
  64.   global MemoVolume, SprFondBar, DcQuit, DcTransit, CastBarrette, CastEfface, SprBoutBar, ColCastBar
  65.   set listTouchesSon to list(29, 18, 19, 20, 21, 23, 22, 26)
  66.   set AccuS to getOne(listTouchesSon, AccuKey)
  67.   if AccuS <> 0 then
  68.     set AccuV to AccuS - 1
  69.     if (the castNum of sprite SprFondBar = CastBarrette) and (DcQuit = 0) then
  70.       if (AccuV <> MemoVolume) and (DcTransit = 0) then
  71.         if AccuV < MemoVolume then
  72.           set ColCastBar to 4
  73.           set AccuG to the number of cast "SonMoins"
  74.         else
  75.           set ColCastBar to 5
  76.           set AccuG to the number of cast "SonPlus"
  77.         end if
  78.         set the locH of sprite SprBoutBar to ColCastBar * 40
  79.         set the castNum of sprite SprBoutBar to AccuG
  80.         updateStage()
  81.         RestoreBoutBar()
  82.       end if
  83.     end if
  84.     set NomMacro to "SetVolume(" & string(AccuV) & ")"
  85.     do(NomMacro)
  86.   end if
  87.   return AccuS
  88. end
  89.  
  90. on ActiveSkip Parametre
  91.   global MemoSkip
  92.   set MemoSkip to Parametre
  93.   set the mouseDownScript to "ExecuteSkip"
  94. end
  95.  
  96. on ActiveSkipSpace Parametre
  97.   global MemoSkip
  98.   set MemoSkip to Parametre
  99. end
  100.  
  101. on DesactiveSkip
  102.   global MemoSkip
  103.   set MemoSkip to "#"
  104.   set the mouseDownScript to EMPTY
  105. end
  106.  
  107. on ExecuteSkip
  108.   global DcDemo, MemoSkip, SprFondBar
  109.   if DcDemo then
  110.     DesactiveSkip()
  111.     return FinDemo()
  112.   end if
  113.   if MemoSkip = "#" then
  114.     exit
  115.   end if
  116.   if rollOver(SprFondBar) and (the key <> numToChar(32)) then
  117.     exit
  118.   end if
  119.   set AccuM to MemoSkip
  120.   DesactiveSkip()
  121.   set Nmacro to word 3 of AccuM
  122.   if Nmacro <> EMPTY then
  123.     CallM(Nmacro)
  124.   end if
  125.   set Nanim to word 1 of AccuM
  126.   set Nframe to word 2 of AccuM
  127.   if (Nanim <> "Nothing") and (Nframe <> "Nothing") then
  128.     CallM("GoMovieRepere(" & QUOTE & ":" & Nanim & QUOTE & "," & QUOTE & Nframe & QUOTE & ")")
  129.   end if
  130.   set Nmacro to word 4 of AccuM
  131.   if Nmacro <> EMPTY then
  132.     CallM(Nmacro)
  133.   end if
  134. end
  135.